.\"   $Id: addchain.3,v 1.1 2002/03/08 13:51:00 fred Exp $
.\" @(#)addchain.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot
.if t \{\
.so man1/alc_contents.mac
.XS \n%
.ti 0.2i
addchain
.XE
.XS4 \n%
.ti 0.2i
addchain
.XE4 \}
.TH ADDCHAIN 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS"
.SH NAME
addchain \- create a \fBchain\fP and add it to a list
.so man1/alc_origin.1
.SH SYNOPSIS
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mut.h"
chain_list \(**addchain(pthead, ptdata)
chain_list \(**pthead;
void \(**ptdata;
.ft R
.fi
.SH PARAMETERS
.TP 20
\fIpthead\fP
Pointer to a \fBchain_list\fP
.TP
\fIptdata\fP
Generic pointer to any kind of information
.SH DESCRIPTION
\fBaddchain\fP creates a new \fBchain\fP element and adds it to the
front of the list pointed to by \fIpthead\fP, and becomes itself the list head.
.br
The \fBchain_list\fPs are mosty used to create temporary lists of homogeneous
elements, for binary trees, and so on.
.br
The \fIptdata\fP points to any kind of list or may itself be a value, if proper
cast is performed at compilation time, and fills the \fIDATA\fP field of the
\fBchain\fP structure.
For details on the structure, see \fBchain\fR(3).
.SH RETURN VALUE
\fBaddchain\fP returns a pointer to the new head of list.
.SH EXAMPLE
.ta 3n 6n 9n 12n 15n 18n 21n
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mut.h"
#include "mlo.h"
chain_list \(**get_external_connectors(ptfig)
lofig_list \(**ptfig;
{
locon_list \(**pt = ptfig\->LOCON;
chain_list \(**c = NULL; /\(** initialized for regularity \(**/
	while (pt) {
		if (pt\->TYPE == EXTERNAL)
			c = addchain(c, (void \(**)pt)
		pt = pt\->NEXT;
	}	
	return c;
}	
.ft R
.fi
.SH SEE ALSO
.BR mbk (1),
.BR chain (3),
.BR freechain (3),
.BR delchain (3).


.so man1/alc_bug_report.1

